#pragma ocne

#include"TcpConnection.h"
#include<string>
#include <functional>
#include <memory>


namespace tmms
{
    namespace network
    {
        using TestMessageCallback = std::function<void(const TcpConnectionPtr&, const std::string &)>;
        class TestContext
        {
            enum
            {
                KTestContextHeader = 1,
                KTestContextBody =2,

            };
        public:
            TestContext(const TcpConnectionPtr &con);
            ~TestContext() = default;

            int Parsemessage(MsgBuffer & buf);
            void SetTestMessageCallback(const TestMessageCallback &cb);
            void SetTestMessageCallback( TestMessageCallback &&cb);

        private:
            TcpConnectionPtr connection_;
            int state_{KTestContextHeader};
            int32_t message_length_{0};
            std::string message_body_;
            TestMessageCallback cb_;

        };
    }
}